home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / 1942.c next >
Text File  |  2000-05-04  |  24KB  |  747 lines

  1. /***************************************************************************
  2.  
  3. 1942 memory map (preliminary)
  4.  
  5. MAIN CPU:
  6.  
  7. 0000-bfff ROM (8000-bfff banked)
  8. cc00-cc7f Sprites
  9. d000-d3ff Video RAM
  10. d400-d7ff Color RAM
  11. d800-dbff Background RAM (groups of 32 bytes, 16 code, 16 color/attribute)
  12. e000-efff RAM
  13.  
  14. read:
  15. c000      IN0
  16. c001      IN1
  17. c002      IN2
  18. c003      DSW0
  19. c004      DSW1
  20.  
  21. write:
  22. c800      command for the audio CPU
  23. c802-c803 background scroll
  24. c804      bit 7: flip screen
  25.           bit 4: cpu B reset
  26.           bit 0: coin counter
  27. c805      background palette bank selector
  28. c806      bit 0-1 ROM bank selector 00=1-N5.BIN
  29.                                     01=1-N6.BIN
  30.                                     10=1-N7.BIN
  31.  
  32.  
  33.  
  34. SOUND CPU:
  35.  
  36. 0000-3fff ROM
  37. 4000-47ff RAM
  38. 6000      command from the main CPU
  39. 8000      8910 #1 control
  40. 8001      8910 #1 write
  41. c000      8910 #2 control
  42. c001      8910 #2 write
  43.  
  44.  
  45.  
  46.  
  47. The following doc was provided by Paul Leaman (paull@phonelink.com)
  48.  
  49.  
  50.                                     1942
  51.  
  52.                             Hardware Description
  53.  
  54.  
  55.                                 Revision 0.4
  56.  
  57.  
  58.  
  59. INTRODUCTION
  60. ------------
  61.  
  62. This document describes the 1942 hardware. This will only be useful
  63. to other emulator authors or for the curious.
  64.  
  65.  
  66. LEGAL
  67. -----
  68.  
  69. This document is freely distributable (with or without the emulator).
  70. You may place it on a WEB page if you want.
  71.  
  72. You are free to use this information for whatever purpose you want providing
  73. that:
  74.  
  75. * No profit is made
  76. * You credit me somewhere in the documentation.
  77. * The document is not changed
  78.  
  79.  
  80.  
  81.  
  82. HARDWARE ARRANGEMENT
  83. --------------------
  84.  
  85. 1942 is a two board system. Board 1 contains 2 Z80A CPUs. One is used for
  86. the sound, the other for the game.
  87.  
  88. The sound system uses 2 YM-2203 synth chips. These are compatible with the
  89. AY-8910. Michael Cuddy has information (and source code) for these chips
  90. on his Web page.
  91.  
  92. The second board contains the custom graphics hardware. There are three
  93. graphics planes. The test screen refers to them as Scroll, Sprite and Tile.
  94.  
  95. The scroll and sprites are arranged in 16*16 blocks. The graphics ROMS
  96. are not memory mapped. They are accessed directly by the hardware.
  97.  
  98. Early Capcom games seem to have similar hardware.
  99.  
  100.  
  101. ROM descriptions:
  102. =================
  103.  
  104. The generally available ROMs are as follows:
  105.  
  106. Board 1 - Code
  107.  
  108. Sound CPU:
  109. 1-C11.BIN       16K Sound ROM 0000-3fff
  110.  
  111. Main CPU:
  112. 1-N3.BIN        16K CODE ROM 0000-4000
  113. 1-N4.BIN        16K CODE ROM 4000-7fff
  114. 1-N5.BIN        16K CODE ROM 8000-bfff (paged)
  115. 1-N6.BIN         8K CODE ROM 8000-9fff (paged)
  116. 1-N7.BIN        16K CODE ROM 8000-bfff (paged)
  117.  
  118. 1-F2.BIN         8K  Character ROM (Not mapped)
  119.  
  120. Board 2 - Graphics board
  121. 2-A5.BIN         8K TILE PLANE 1
  122. 2-A3.BIN         8K TILE PLANE 2
  123. 2-A1.BIN         8K TILE PLANE 3
  124.  
  125. 2-A6.BIN         8K TILE PLANE 1
  126. 2-A4.BIN         8K TILE PLANE 2
  127. 2-A2.BIN         8K TILE PLANE 3
  128.  
  129. 2-N1.BIN        16K OBJECT PLANE 1&2
  130. 2-L1.BIN        16K OBJECT PLANE 3&4
  131.  
  132. 2-L2.BIN        16K OBJECT PLANE 1&2
  133. 2-N2.BIN        16K OBJECT PLANE 3&4
  134.  
  135.  
  136. SOUND CPU MEMORY MAP
  137. ====================
  138.  
  139. 0000-3fff Sound board CODE.
  140. 4000-47ff RAM data area and stack
  141. 6000      Sound input port. 0-0x1f
  142. 8000      PSG 1 Address
  143. 8001      PSG 1 Data
  144. c000      PSG 2 Address
  145. c001      PSG 2 Data
  146.  
  147. Runs in interrupt mode 1.
  148.  
  149. After initialization, Most of the sound code is driven by interrupt (0x38).
  150. The code sits around waiting for the value in 0x6000 to change.
  151.  
  152. All Capcom games seem to share the same music hardware. The addresses of
  153. the PSG chips and input vary according to the game.
  154.  
  155.  
  156.  
  157. MAIN CPU MEMORY MAP
  158. ===================
  159.  
  160. 0000-bfff ROM Main code. Area (8000-bfff) is paged in
  161.  
  162.           Input ports
  163. c000      Coin mech and start buttons
  164.           0x10 Coin up
  165.           0x08 Plater 4 start ????
  166.           0x04 Player 3 start ????
  167.           0x02 Player 2 start
  168.           0x01 Player 1 start
  169. c001      Joystick
  170. c002      Joystick
  171. c003      DIP switch 1 (1=off 0=on)
  172. c004      DIP switch 2 (1=off 0=on)
  173.  
  174.           Output ports
  175. c800      Sound output
  176. c801      Unused
  177. c802      Scroll register (lower 4 bits smooth, upper 4 bits rough)
  178. c803      Scroll register MSB
  179. c804      Watchdog circuit flip-flop ????
  180. c805      Unknown
  181. c806      Bits
  182.             0-1 ROM paging   0=1-N5.BIN
  183.                              1=1-N6.BIN
  184.                              2=1-N7.BIN
  185.  
  186.           Video
  187. cc00-cc7f Sprite RAM
  188.           32 * 4 bytes
  189.  
  190. d000-d3ff Character RAM
  191. d400-d7ff Character attribute
  192.           Bits
  193.              0x80 MSB character
  194.              0x40
  195.              0x20
  196.              rest Attribute
  197. d800-dbff Scroll RAM / attributes
  198.              Alternating 16 byte rows of characters / attributes
  199.  
  200.              Attribute
  201.                 0x80 MSB tile
  202.                 0x40 Flip X
  203.                 0x20 Flip Y
  204.                 rest Attribute
  205. e000-efff    RAM data / stack area
  206. F000-FFFF    Unused
  207.  
  208. Game runs in interrupt mode 0 (the devices supply the interrupt number).
  209.  
  210. Two interrupts must be triggered per refresh for the game to function
  211. correctly.
  212.  
  213. 0x10 is the video retrace. This controls the speed of the game and generally
  214.      drives the code. This must be triggerd for each video retrace.
  215. 0x08 is the sound card service interupt. The game uses this to throw sounds
  216.      at the sound CPU.
  217.  
  218.  
  219.  
  220. Character RAM arrangement
  221. -------------------------
  222.  
  223. The characters are rotated 90 degrees vertically. Each column is 32 bytes.
  224.  
  225. The attributes are arranged so that they correspond to each column.
  226.  
  227. Attribute
  228.       0x80  Char MSB Set to get characters from 0x100 to 0x1ff
  229.       0x40  Unknown
  230.       rest  Character palette colour.
  231.  
  232.  
  233. Tile system
  234. -----------
  235.  
  236. Tiles are arranged in rotational buffer. Each line consists of 32 bytes.
  237. The first 16 bytes are the tile values, the second 16 bytes contain the
  238. attributes.
  239.  
  240. This arrangement may vary according to the machine. For example, Vulgus,
  241. which is a horizontal/ vertical scroller uses 32 bytes per line. The
  242. attributes are in a separate block of memory. This is probably done to
  243. accommodate horizontal scrolling.
  244.  
  245.       0x80 Tile MSB (Set to obtain tiles 0x100-0x1ff.
  246.       0x40 Tile flip X
  247.       0x20 Tile Flip Y
  248.       rest Palette colour scheme.
  249.  
  250. The scroll rough register determines the starting point for the bottom of the
  251. screen. The buffer is circular. The bottom of the screen is at the start of
  252. tile memory. To address the start of a line:
  253.  
  254.      lineaddress=(roughscroll * 0x20) & 0x3ff
  255.      attributeaddress=lineaddress+0x10
  256.  
  257. Make sure to combine the MSB value to make up the rough scroll address.
  258.  
  259.  
  260. Sprite arrangement
  261. ------------------
  262.  
  263. Sprites are 16*16 blocks. Attribute bits determine whether or not the
  264. sprite is wider.
  265.  
  266. 32 Sprites. 4 bytes for each sprite
  267.     00 Sprite number 0-255
  268.     01 Colour Code
  269.          0x80 Sprite number MSB (256-512)
  270.          0x40 Sprite size 16*64 (Very wide sprites)
  271.          0x20 Sprite size 16*32 (Wide sprites)
  272.          0x10 Sprite Y position MSB
  273.          rest colour code
  274.     02 Sprite X position
  275.     03 Sprite Y position
  276.  
  277. The sprite sequence is slightly odd within the sprite data ROMS. It is
  278. necessary to swap sprites 0x0080-0x00ff with sprites 0x0100-0x017f to get
  279. the correct order. This is best done at load-up time.
  280.  
  281. If 0x40 is set, the next 4 sprite objects are combined into one from left
  282. to right.
  283. if 0x20 is set, the next 2 sprite objects are combined into one from left
  284. to right.
  285. if none of the above bits are set, the sprite is a simple 16*16 object.
  286.  
  287.  
  288. Sprite clipping:
  289. ----------------
  290.  
  291. The title sprites are supposed to appear to move into each other. I
  292. have not yet found the mechanism to do this.
  293.  
  294.  
  295. Palette:
  296. --------
  297.  
  298. Palette system is in hardware. There are 16 colours for each component (char,
  299. scroll and object).
  300.  
  301. The .PAL file format used by the emulator is as follows:
  302.  
  303. Offset
  304. 0x0000-0x000f Char 16 colour palette colours
  305. 0x0010-0x001f Scroll 16 colour palette colours
  306. 0x0020-0x002f Object 16 colour palette colours
  307. 0x0030-0x00f0 Char colour schemes (3 bytes each). Values are 0-0xff
  308. 0x00f0-0x01ef Object colour scheme (16 bytes per scheme)
  309. 0x01f0-0x02ef Scroll colour scheme (8 bytes per scheme)
  310.  
  311. Note that only half the colour schemes are shown on the scroll palette
  312. screen. The game uses colour values that are not shown. There must
  313. be some mirroring here. Either that, or I have got the scheme wrong.
  314.  
  315.  
  316.  
  317. Interesting RAM locations:
  318. --------------------------
  319.  
  320. 0xE09B - Number of rolls
  321.  
  322.  
  323.  
  324. Graphics format:
  325. ----------------
  326.  
  327. Roberto Ventura has written a document, detailing the Ghosts 'n' Goblins
  328. graphics layout. This can be found on the repository.
  329.  
  330.  
  331. Schematics:
  332. -----------
  333.  
  334. Schematics for Commando can be found at:
  335.  
  336. This game is fairly similar to 1942.
  337.  
  338.  
  339.  
  340. DIP Switch Settings
  341. -------------------
  342.  
  343.  
  344. WWW.SPIES.COM contains DIP switch settings.
  345.  
  346.  
  347. ***************************************************************************/
  348.  
  349. #include "driver.h"
  350. #include "vidhrdw/generic.h"
  351.  
  352.  
  353.  
  354. extern unsigned char *c1942_backgroundram;
  355. extern size_t c1942_backgroundram_size;
  356. extern unsigned char *c1942_scroll;
  357. extern unsigned char *c1942_palette_bank;
  358. int c1942_vh_start(void);
  359. void c1942_vh_stop(void);
  360. void c1942_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  361. WRITE_HANDLER( c1942_background_w );
  362. WRITE_HANDLER( c1942_palette_bank_w );
  363. WRITE_HANDLER( c1942_flipscreen_w );
  364. void c1942_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  365.  
  366.  
  367.  
  368. WRITE_HANDLER( c1942_bankswitch_w )
  369. {
  370.     int bankaddress;
  371.     unsigned char *RAM = memory_region(REGION_CPU1);
  372.  
  373.  
  374.     bankaddress = 0x10000 + (data & 0x03) * 0x4000;
  375.     cpu_setbank(1,&RAM[bankaddress]);
  376. }
  377.  
  378.  
  379.  
  380. int c1942_interrupt(void)
  381. {
  382.     if (cpu_getiloops() != 0) return 0x00cf;    /* RST 08h */
  383.     else return 0x00d7;    /* RST 10h - vblank */
  384. }
  385.  
  386.  
  387.  
  388. static struct MemoryReadAddress readmem[] =
  389. {
  390.     { 0x0000, 0x7fff, MRA_ROM },
  391.     { 0x8000, 0xbfff, MRA_BANK1 },
  392.     { 0xc000, 0xc000, input_port_0_r },    /* IN0 */
  393.     { 0xc001, 0xc001, input_port_1_r },    /* IN1 */
  394.     { 0xc002, 0xc002, input_port_2_r },    /* IN2 */
  395.     { 0xc003, 0xc003, input_port_3_r },    /* DSW0 */
  396.     { 0xc004, 0xc004, input_port_4_r },    /* DSW1 */
  397.     { 0xd000, 0xdbff, MRA_RAM },
  398.     { 0xe000, 0xefff, MRA_RAM },
  399.     { -1 }    /* end of table */
  400. };
  401.  
  402. static struct MemoryWriteAddress writemem[] =
  403. {
  404.     { 0x0000, 0xbfff, MWA_ROM },
  405.     { 0xc800, 0xc800, soundlatch_w },
  406.     { 0xc802, 0xc803, MWA_RAM, &c1942_scroll },
  407.     { 0xc804, 0xc804, c1942_flipscreen_w },
  408.     { 0xc805, 0xc805, c1942_palette_bank_w, &c1942_palette_bank },
  409.     { 0xc806, 0xc806, c1942_bankswitch_w },
  410.     { 0xcc00, 0xcc7f, MWA_RAM, &spriteram, &spriteram_size },
  411.     { 0xd000, 0xd3ff, videoram_w, &videoram, &videoram_size },
  412.     { 0xd400, 0xd7ff, colorram_w, &colorram },
  413.     { 0xd800, 0xdbff, c1942_background_w, &c1942_backgroundram, &c1942_backgroundram_size },
  414.     { 0xe000, 0xefff, MWA_RAM },
  415.     { -1 }    /* end of table */
  416. };
  417.  
  418.  
  419.  
  420. static struct MemoryReadAddress sound_readmem[] =
  421. {
  422.     { 0x0000, 0x3fff, MRA_ROM },
  423.     { 0x4000, 0x47ff, MRA_RAM },
  424.     { 0x6000, 0x6000, soundlatch_r },
  425.     { -1 }    /* end of table */
  426. };
  427.  
  428. static struct MemoryWriteAddress sound_writemem[] =
  429. {
  430.     { 0x0000, 0x3fff, MWA_ROM },
  431.     { 0x4000, 0x47ff, MWA_RAM },
  432.     { 0x8000, 0x8000, AY8910_control_port_0_w },
  433.     { 0x8001, 0x8001, AY8910_write_port_0_w },
  434.     { 0xc000, 0xc000, AY8910_control_port_1_w },
  435.     { 0xc001, 0xc001, AY8910_write_port_1_w },
  436.     { -1 }    /* end of table */
  437. };
  438.  
  439.  
  440.  
  441. INPUT_PORTS_START( 1942 )
  442.     PORT_START    /* IN0 */
  443.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  444.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  445.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  446.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  447.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )
  448.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  449.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  450.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  451.  
  452.     PORT_START    /* IN1 */
  453.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  454.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  455.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  456.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  457.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  458.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  459.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  460.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  461.  
  462.     PORT_START    /* IN2 */
  463.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  464.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  465.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  466.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  467.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  468.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  469.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  470.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* probably unused */
  471.  
  472.     PORT_START    /* DSW0 */
  473.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
  474.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
  475.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  476.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  477.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  478.     PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
  479.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
  480.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_4C ) )
  481.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  482.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
  483.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  484.     PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
  485.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )
  486.     PORT_DIPSETTING(    0x30, "20000 80000" )
  487.     PORT_DIPSETTING(    0x20, "20000 100000" )
  488.     PORT_DIPSETTING(    0x10, "30000 80000" )
  489.     PORT_DIPSETTING(    0x00, "30000 100000" )
  490.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
  491.     PORT_DIPSETTING(    0x80, "1" )
  492.     PORT_DIPSETTING(    0x40, "2" )
  493.     PORT_DIPSETTING(    0xc0, "3" )
  494.     PORT_DIPSETTING(    0x00, "5" )
  495.  
  496.     PORT_START    /* DSW1 */
  497.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) )
  498.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
  499.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  500.     PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
  501.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  502.     PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
  503.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
  504.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_4C ) )
  505.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  506.     PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
  507.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) )
  508.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  509.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  510.     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
  511.     PORT_DIPSETTING(    0x40, "Easy" )
  512.     PORT_DIPSETTING(    0x60, "Normal" )
  513.     PORT_DIPSETTING(    0x20, "Hard" )
  514.     PORT_DIPSETTING(    0x00, "Hardest" )
  515.     PORT_DIPNAME( 0x80, 0x80, "Freeze" )
  516.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  517.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  518. INPUT_PORTS_END
  519.  
  520.  
  521.  
  522. static struct GfxLayout charlayout =
  523. {
  524.     8,8,    /* 8*8 characters */
  525.     512,    /* 512 characters */
  526.     2,    /* 2 bits per pixel */
  527.     { 4, 0 },
  528.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 },
  529.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  530.     16*8    /* every char takes 16 consecutive bytes */
  531. };
  532. static struct GfxLayout tilelayout =
  533. {
  534.     16,16,    /* 16*16 tiles */
  535.     512,    /* 512 tiles */
  536.     3,    /* 3 bits per pixel */
  537.     { 0, 512*32*8, 2*512*32*8 },    /* the bitplanes are separated */
  538.     { 0, 1, 2, 3, 4, 5, 6, 7,
  539.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 },
  540.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  541.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  542.     32*8    /* every tile takes 32 consecutive bytes */
  543. };
  544. static struct GfxLayout spritelayout =
  545. {
  546.     16,16,    /* 16*16 sprites */
  547.     512,    /* 512 sprites */
  548.     4,    /* 4 bits per pixel */
  549.     { 512*64*8+4, 512*64*8+0, 4, 0 },
  550.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3,
  551.             32*8+0, 32*8+1, 32*8+2, 32*8+3, 33*8+0, 33*8+1, 33*8+2, 33*8+3 },
  552.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  553.             8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  554.     64*8    /* every sprite takes 64 consecutive bytes */
  555. };
  556.  
  557. static struct GfxDecodeInfo gfxdecodeinfo[] =
  558. {
  559.     { REGION_GFX1, 0, &charlayout,             0, 64 },
  560.     { REGION_GFX2, 0, &tilelayout,          64*4, 4*32 },
  561.     { REGION_GFX3, 0, &spritelayout, 64*4+4*32*8, 16 },
  562.     { -1 } /* end of array */
  563. };
  564.  
  565.  
  566.  
  567. static struct AY8910interface ay8910_interface =
  568. {
  569.     2,    /* 2 chips */
  570.     1500000,    /* 1.5 MHz ? */
  571.     { 25, 25 },
  572.     { 0 },
  573.     { 0 },
  574.     { 0 },
  575.     { 0 }
  576. };
  577.  
  578.  
  579.  
  580. static struct MachineDriver machine_driver_1942 =
  581. {
  582.     /* basic machine hardware */
  583.     {
  584.         {
  585.             CPU_Z80,
  586.             4000000,    /* 4 Mhz (?) */
  587.             readmem,writemem,0,0,
  588.             c1942_interrupt,2
  589.         },
  590.         {
  591.             CPU_Z80 | CPU_AUDIO_CPU,
  592.             3000000,    /* 3 Mhz ??? */
  593.             sound_readmem,sound_writemem,0,0,
  594.             interrupt,4
  595.         }
  596.     },
  597.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  598.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  599.     0,
  600.  
  601.     /* video hardware */
  602.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  603.     gfxdecodeinfo,
  604.     256, 64*4+4*32*8+16*16,
  605.     c1942_vh_convert_color_prom,
  606.  
  607.     VIDEO_TYPE_RASTER,
  608.     0,
  609.     c1942_vh_start,
  610.     c1942_vh_stop,
  611.     c1942_vh_screenrefresh,
  612.  
  613.     /* sound hardware */
  614.     0,0,0,0,
  615.     {
  616.         {
  617.             SOUND_AY8910,
  618.             &ay8910_interface
  619.         }
  620.     }
  621. };
  622.  
  623.  
  624.  
  625. /***************************************************************************
  626.  
  627.   Game driver(s)
  628.  
  629. ***************************************************************************/
  630.  
  631. ROM_START( 1942 )
  632.     ROM_REGION( 0x1c000, REGION_CPU1 )    /* 64k for code + 3*16k for the banked ROMs images */
  633.     ROM_LOAD( "1-n3a.bin",    0x00000, 0x4000, 0x40201bab )
  634.     ROM_LOAD( "1-n4.bin",     0x04000, 0x4000, 0xa60ac644 )
  635.     ROM_LOAD( "1-n5.bin",     0x10000, 0x4000, 0x835f7b24 )
  636.     ROM_LOAD( "1-n6.bin",     0x14000, 0x2000, 0x821c6481 )
  637.     ROM_LOAD( "1-n7.bin",     0x18000, 0x4000, 0x5df525e1 )
  638.  
  639.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  640.     ROM_LOAD( "1-c11.bin",    0x0000, 0x4000, 0xbd87f06b )
  641.  
  642.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  643.     ROM_LOAD( "1-f2.bin",     0x0000, 0x2000, 0x6ebca191 )    /* characters */
  644.  
  645.     ROM_REGION( 0xc000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  646.     ROM_LOAD( "2-a1.bin",     0x0000, 0x2000, 0x3884d9eb )    /* tiles */
  647.     ROM_LOAD( "2-a2.bin",     0x2000, 0x2000, 0x999cf6e0 )
  648.     ROM_LOAD( "2-a3.bin",     0x4000, 0x2000, 0x8edb273a )
  649.     ROM_LOAD( "2-a4.bin",     0x6000, 0x2000, 0x3a2726c3 )
  650.     ROM_LOAD( "2-a5.bin",     0x8000, 0x2000, 0x1bd3d8bb )
  651.     ROM_LOAD( "2-a6.bin",     0xa000, 0x2000, 0x658f02c4 )
  652.  
  653.     ROM_REGION( 0x10000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  654.     ROM_LOAD( "2-l1.bin",     0x00000, 0x4000, 0x2528bec6 )    /* sprites */
  655.     ROM_LOAD( "2-l2.bin",     0x04000, 0x4000, 0xf89287aa )
  656.     ROM_LOAD( "2-n1.bin",     0x08000, 0x4000, 0x024418f8 )
  657.     ROM_LOAD( "2-n2.bin",     0x0c000, 0x4000, 0xe2c7e489 )
  658.  
  659.     ROM_REGION( 0x0600, REGION_PROMS )
  660.     ROM_LOAD( "08e_sb-5.bin", 0x0000, 0x0100, 0x93ab8153 )    /* red component */
  661.     ROM_LOAD( "09e_sb-6.bin", 0x0100, 0x0100, 0x8ab44f7d )    /* green component */
  662.     ROM_LOAD( "10e_sb-7.bin", 0x0200, 0x0100, 0xf4ade9a4 )    /* blue component */
  663.     ROM_LOAD( "f01_sb-0.bin", 0x0300, 0x0100, 0x6047d91b )    /* char lookup table */
  664.     ROM_LOAD( "06d_sb-4.bin", 0x0400, 0x0100, 0x4858968d )    /* tile lookup table */
  665.     ROM_LOAD( "03k_sb-8.bin", 0x0500, 0x0100, 0xf6fad943 )    /* sprite lookup table */
  666. ROM_END
  667.  
  668. ROM_START( 1942a )
  669.     ROM_REGION( 0x1c000, REGION_CPU1 )    /* 64k for code + 3*16k for the banked ROMs images */
  670.     ROM_LOAD( "1-n3.bin",     0x00000, 0x4000, 0x612975f2 )
  671.     ROM_LOAD( "1-n4.bin",     0x04000, 0x4000, 0xa60ac644 )
  672.     ROM_LOAD( "1-n5.bin",     0x10000, 0x4000, 0x835f7b24 )
  673.     ROM_LOAD( "1-n6.bin",     0x14000, 0x2000, 0x821c6481 )
  674.     ROM_LOAD( "1-n7.bin",     0x18000, 0x4000, 0x5df525e1 )
  675.  
  676.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  677.     ROM_LOAD( "1-c11.bin",    0x0000, 0x4000, 0xbd87f06b )
  678.  
  679.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  680.     ROM_LOAD( "1-f2.bin",     0x0000, 0x2000, 0x6ebca191 )    /* characters */
  681.  
  682.     ROM_REGION( 0xc000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  683.     ROM_LOAD( "2-a1.bin",     0x0000, 0x2000, 0x3884d9eb )    /* tiles */
  684.     ROM_LOAD( "2-a2.bin",     0x2000, 0x2000, 0x999cf6e0 )
  685.     ROM_LOAD( "2-a3.bin",     0x4000, 0x2000, 0x8edb273a )
  686.     ROM_LOAD( "2-a4.bin",     0x6000, 0x2000, 0x3a2726c3 )
  687.     ROM_LOAD( "2-a5.bin",     0x8000, 0x2000, 0x1bd3d8bb )
  688.     ROM_LOAD( "2-a6.bin",     0xa000, 0x2000, 0x658f02c4 )
  689.  
  690.     ROM_REGION( 0x10000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  691.     ROM_LOAD( "2-l1.bin",     0x00000, 0x4000, 0x2528bec6 )    /* sprites */
  692.     ROM_LOAD( "2-l2.bin",     0x04000, 0x4000, 0xf89287aa )
  693.     ROM_LOAD( "2-n1.bin",     0x08000, 0x4000, 0x024418f8 )
  694.     ROM_LOAD( "2-n2.bin",     0x0c000, 0x4000, 0xe2c7e489 )
  695.  
  696.     ROM_REGION( 0x0600, REGION_PROMS )
  697.     ROM_LOAD( "08e_sb-5.bin", 0x0000, 0x0100, 0x93ab8153 )    /* red component */
  698.     ROM_LOAD( "09e_sb-6.bin", 0x0100, 0x0100, 0x8ab44f7d )    /* green component */
  699.     ROM_LOAD( "10e_sb-7.bin", 0x0200, 0x0100, 0xf4ade9a4 )    /* blue component */
  700.     ROM_LOAD( "f01_sb-0.bin", 0x0300, 0x0100, 0x6047d91b )    /* char lookup table */
  701.     ROM_LOAD( "06d_sb-4.bin", 0x0400, 0x0100, 0x4858968d )    /* tile lookup table */
  702.     ROM_LOAD( "03k_sb-8.bin", 0x0500, 0x0100, 0xf6fad943 )    /* sprite lookup table */
  703. ROM_END
  704.  
  705. ROM_START( 1942b )
  706.     ROM_REGION( 0x1c000, REGION_CPU1 )    /* 64k for code + 3*16k for the banked ROMs images */
  707.     ROM_LOAD( "srb-03.n3",    0x00000, 0x4000, 0xd9dafcc3 )
  708.     ROM_LOAD( "srb-04.n4",    0x04000, 0x4000, 0xda0cf924 )
  709.     ROM_LOAD( "srb-05.n5",    0x10000, 0x4000, 0xd102911c )
  710.     ROM_LOAD( "srb-06.n6",    0x14000, 0x2000, 0x466f8248 )
  711.     ROM_LOAD( "srb-07.n7",    0x18000, 0x4000, 0x0d31038c )
  712.  
  713.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  714.     ROM_LOAD( "1-c11.bin",    0x0000, 0x4000, 0xbd87f06b )
  715.  
  716.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  717.     ROM_LOAD( "1-f2.bin",     0x0000, 0x2000, 0x6ebca191 )    /* characters */
  718.  
  719.     ROM_REGION( 0xc000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  720.     ROM_LOAD( "2-a1.bin",     0x0000, 0x2000, 0x3884d9eb )    /* tiles */
  721.     ROM_LOAD( "2-a2.bin",     0x2000, 0x2000, 0x999cf6e0 )
  722.     ROM_LOAD( "2-a3.bin",     0x4000, 0x2000, 0x8edb273a )
  723.     ROM_LOAD( "2-a4.bin",     0x6000, 0x2000, 0x3a2726c3 )
  724.     ROM_LOAD( "2-a5.bin",     0x8000, 0x2000, 0x1bd3d8bb )
  725.     ROM_LOAD( "2-a6.bin",     0xa000, 0x2000, 0x658f02c4 )
  726.  
  727.     ROM_REGION( 0x10000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  728.     ROM_LOAD( "2-l1.bin",     0x00000, 0x4000, 0x2528bec6 )    /* sprites */
  729.     ROM_LOAD( "2-l2.bin",     0x04000, 0x4000, 0xf89287aa )
  730.     ROM_LOAD( "2-n1.bin",     0x08000, 0x4000, 0x024418f8 )
  731.     ROM_LOAD( "2-n2.bin",     0x0c000, 0x4000, 0xe2c7e489 )
  732.  
  733.     ROM_REGION( 0x0600, REGION_PROMS )
  734.     ROM_LOAD( "08e_sb-5.bin", 0x0000, 0x0100, 0x93ab8153 )    /* red component */
  735.     ROM_LOAD( "09e_sb-6.bin", 0x0100, 0x0100, 0x8ab44f7d )    /* green component */
  736.     ROM_LOAD( "10e_sb-7.bin", 0x0200, 0x0100, 0xf4ade9a4 )    /* blue component */
  737.     ROM_LOAD( "f01_sb-0.bin", 0x0300, 0x0100, 0x6047d91b )    /* char lookup table */
  738.     ROM_LOAD( "06d_sb-4.bin", 0x0400, 0x0100, 0x4858968d )    /* tile lookup table */
  739.     ROM_LOAD( "03k_sb-8.bin", 0x0500, 0x0100, 0xf6fad943 )    /* sprite lookup table */
  740. ROM_END
  741.  
  742.  
  743.  
  744. GAME( 1984, 1942,  0,    1942, 1942, 0, ROT270, "Capcom", "1942 (set 1)" )
  745. GAME( 1984, 1942a, 1942, 1942, 1942, 0, ROT270, "Capcom", "1942 (set 2)" )
  746. GAME( 1984, 1942b, 1942, 1942, 1942, 0, ROT270, "Capcom", "1942 (set 3)" )
  747.